#ifndef PROXYFACTORY_H
#define PROXYFACTORY_H

#include <QStack>
#include <QVector>
#include <QTimer>
#include <QNetworkProxy>
#include <QNetworkAccessManager>
#include <QQueue>
#include <QNetworkReply>
#include "proxy/proxydesc.h"

class ProxyFactory:public QObject
{
    Q_OBJECT
    QQueue<ProxyDesc*> pending;
    QQueue<ProxyDesc*> notWorking;
    QQueue<ProxyDesc*> working;
    QQueue<ProxyDesc*> inUse;
    QNetworkAccessManager testSocket;
    QTimer proxyTimer;
    void testPending();
public:
    ProxyFactory();
    ~ProxyFactory();
    ProxyDesc* getProxy();
    ProxyDesc* getProxyFor(QString);
    QVector<ProxyDesc*> getUpdProxies();
    QVector<ProxyDesc*> getAllProxies();
signals:

public slots:
    void returnProxy(ProxyDesc*);
    void timerRing();
    void socketResponse(QNetworkReply*);
    //void error(QNetworkReply::NetworkError);
};

#endif // PROXYFACTORY_H
